Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top |

Working With Graphics Importers

GetGraphicsImporterForDataRef

Locates and opens a graphics importer component that can be used to draw the specified data reference.

pascal OSErr GetGraphicsImporterForDataRef(
                     Handle dataRef,
                     OSType dataRefType,
                     ComponentInstance *gi);
dataRef
Specifies the data reference to be drawn using a graphics importer component.
dataRefType
The type of the data reference specified by the dataRef parameter. For alias-based data references, the dataRef handle contains an AliasRecord, and dataRefType is equal to rAliasType .
gi
A pointer to a ComponentInstance in which the best graphics importer for working with the specified data reference will be returned. If no graphics importer can be found, the ComponentInstance will be set to nil .

DISCUSSION

GetGraphicsImporterForDataRef tries to locate a graphics importer component for the specified data reference by checking the file name extension of the file, the file type information, and the MIME type of the file. The file name extension is retrieved from the data reference by use of the DataHGetFileName call to the data handler associated with the data reference.

If it is unable to locate a graphics importer for the file, the returned ComponentInstance is set to nil . If it is able to locate a graphics importer for the data reference, the returned graphics importer ComponentInstance will have already been set up to draw the specified data reference in the current port.

The caller of GetGraphicsImporterForDataRef is responsible for closing the returned ComponentInstance using CloseComponent .

GetGraphicsImporterForFile

Locates and opens a graphics importer component that can be used to draw the specified file.

pascal OSErr GetGraphicsImporterForFile(
                     const FSSpec *theFile,
                     ComponentInstance *gi);
theFile
Specifies the file to be drawn using a graphics importer component.
gi
A pointer to a ComponentInstance in which the best graphics importer for working with the specified file will be returned. If no graphics importer can be found, the ComponentInstance will be set to nil .

DISCUSSION

GetGraphicsImporterForFile first tries to locate a graphics importer component for the specified file based on the Macintosh file type of the file. If it is unable to locate a graphics importer component based on the Macintosh file type, and the file type is 'TEXT' , GetGraphicsImporterForFile will try to locate a graphics importer component for the specified file based on the file name extension of the file.

If it is unable to locate a graphics importer for the file, the returned ComponentInstance is set to nil . If it is able to locate a graphics importer for the file, the returned graphics importer ComponentInstance will have already been set up to draw the specified file in the current port.

The caller of GetGraphicsImporterForFile is responsible for closing the returned ComponentInstance using CloseComponent .

 


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top |